#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:read_file_with_line_numbers.py
# author:张世航
# datetime:2024/11/9 17:44
# software: PyCharm
"""
this is function  description 
"""
# import module your need

# 2 写一个程序，从input.txt中读取之前输入的数据，存入列表中，再加上行号打印显示；格式如下
# 1.#第一行： xxxx
# 2.#第二行： xxxx
# 2. 从input.txt中读取数据并打印行号
def read_file_with_line_numbers():
    try:
        with open("input.txt", "r", encoding="utf-8") as file:
            lines = file.readlines()

        for index, line in enumerate(lines, start=1):
            print(f"{index}. #第{index}行： {line.strip()}")
    except FileNotFoundError:
        print("文件input.txt未找到。")
    except Exception as e:
        print(f"发生错误: {e}")


read_file_with_line_numbers()
